package com.Zhu.demo.pojo;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;


import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

@Table(name = "user")
@Entity()
@Data
@ApiModel(description = "用户实体")
public class User implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    @ApiModelProperty(value = "用户id", example = "1")
    private Integer userId;


    @Column(name = "user_name")
    @NotNull(message = "用户名不能为空")
    @Size(min = 2, max = 15, message = "用户名长度需在2-15之间")
    @ApiModelProperty(value = "用户名", example = "xxx")
    private String userName;


    @Column(name = "user_age")
    @Min(value = 1, message = "年龄不能小于1")
    @Max(value = 100, message = "年龄不能大于100")
    @ApiModelProperty(value = "用户年龄", example = "18")
    private Integer userAge;


    @Column(name = "user_password")
    @Size(min = 6, max = 20, message = "密码长度需在6-20之间")
    @ApiModelProperty(value = "用户密码", example = "123456")
    private String userPassword;
}
